diff options
Diffstat (limited to 'docs/pages/api/user/[id].tsx')
| -rw-r--r-- | docs/pages/api/user/[id].tsx | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/docs/pages/api/user/[id].tsx b/docs/pages/api/user/[id].tsx deleted file mode 100644 index 091d716..0000000 --- a/docs/pages/api/user/[id].tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { NextApiRequest, NextApiResponse } from "next"; -import { withSentry } from "@sentry/nextjs"; -import { - getSubscriber, - Subscriber, - updateSubscriber, -} from "../../../lib/ConvertKitApi"; - -async function handler(req: NextApiRequest, res: NextApiResponse) { - try { - if (req.method === "PUT") { - const subscriber = await updateSubscriber( - req.query.id as string, - { - first_name: req.body.first_name, - email_address: req.body.email_address, - fields: req.body.fields, - } as Subscriber - ); - res.setHeader("Content-Type", "application/json"); - res.statusCode = 204; - res.json(subscriber); - } else { - const subscriber = await getSubscriber(req.query.id as string); - res.setHeader("Content-Type", "application/json"); - res.statusCode = 200; - res.json(subscriber); - } - } catch (error) { - console.log(error); - res.statusCode = 500; - res.json({ okay: false }); - } -} - -export default withSentry(handler); |
